gtk_widget_get_style_context (widget),
&icon_width, &icon_height);
icon_surface = gtk_icon_helper_load_surface (info->icon_helper,
- gtk_widget_get_style_context (widget));
+ gtk_widget_get_style_context (widget),
+ scale);
icon_x = info->hot_x;
icon_y = info->hot_y;
{
cairo_surface_t *source, *surface;
cairo_pattern_t *pattern;
+ GdkWindow *root;
cairo_t *cr;
gtk_widget_set_size_request (window, width, height);
- source = gtk_icon_helper_load_surface (helper, gtk_widget_get_style_context (window));
+ root = gdk_screen_get_root_window (screen);
+ source = gtk_icon_helper_load_surface (helper,
+ gtk_widget_get_style_context (window),
+ gdk_window_get_scale_factor (root));
surface = gdk_window_create_similar_surface (gdk_screen_get_root_window (screen),
CAIRO_CONTENT_COLOR,
width, height);
static gboolean
get_pixbuf_size (GtkIconHelper *self,
GtkStyleContext *context,
+ gint scale,
GdkPixbuf *orig_pixbuf,
gint orig_scale,
gint *width_out,
{
gboolean scale_pixmap;
gint width, height;
- int scale;
- scale = get_scale_factor (self, context);
scale_pixmap = FALSE;
if (self->priv->force_scale_pixbuf &&
static cairo_surface_t *
ensure_surface_from_pixbuf (GtkIconHelper *self,
GtkStyleContext *context,
+ gint scale,
GdkPixbuf *orig_pixbuf,
gint orig_scale)
{
gint width, height;
cairo_surface_t *surface;
GdkPixbuf *pixbuf, *stated;
- int scale;
if (get_pixbuf_size (self,
context,
+ scale,
orig_pixbuf,
orig_scale,
&width, &height, &scale))
static cairo_surface_t *
ensure_surface_for_icon_set (GtkIconHelper *self,
GtkStyleContext *context,
+ gint scale,
GtkIconSet *icon_set)
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
return gtk_icon_set_render_icon_surface (icon_set, context,
self->priv->icon_size,
- get_scale_factor (self, context),
+ scale,
self->priv->window);
G_GNUC_END_IGNORE_DEPRECATIONS;
}
static cairo_surface_t *
ensure_surface_for_gicon (GtkIconHelper *self,
GtkStyleContext *context,
+ gint scale,
GIcon *gicon)
{
GtkIconTheme *icon_theme;
- gint width, height, scale;
+ gint width, height;
GtkIconInfo *info;
GtkIconLookupFlags flags;
cairo_surface_t *surface;
flags = get_icon_lookup_flags (self, context);
ensure_icon_size (self, &width, &height);
- scale = get_scale_factor (self, context);
info = gtk_icon_theme_lookup_by_gicon_for_scale (icon_theme,
gicon,
cairo_surface_t *
gtk_icon_helper_load_surface (GtkIconHelper *self,
- GtkStyleContext *context)
+ GtkStyleContext *context,
+ int scale)
{
cairo_surface_t *surface;
GtkIconSet *icon_set;
break;
case GTK_IMAGE_PIXBUF:
- surface = ensure_surface_from_pixbuf (self, context,
+ surface = ensure_surface_from_pixbuf (self, context, scale,
gtk_image_definition_get_pixbuf (self->priv->def),
gtk_image_definition_get_scale (self->priv->def));
break;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
icon_set = gtk_icon_factory_lookup_default (gtk_image_definition_get_stock (self->priv->def));
if (icon_set != NULL)
- surface = ensure_surface_for_icon_set (self, context, icon_set);
+ surface = ensure_surface_for_icon_set (self, context, scale, icon_set);
else
surface = NULL;
G_GNUC_END_IGNORE_DEPRECATIONS;
case GTK_IMAGE_ICON_SET:
icon_set = gtk_image_definition_get_icon_set (self->priv->def);
- surface = ensure_surface_for_icon_set (self, context, icon_set);
+ surface = ensure_surface_for_icon_set (self, context, scale, icon_set);
break;
case GTK_IMAGE_ICON_NAME:
gicon = g_themed_icon_new_with_default_fallbacks (gtk_image_definition_get_icon_name (self->priv->def));
else
gicon = g_themed_icon_new (gtk_image_definition_get_icon_name (self->priv->def));
- surface = ensure_surface_for_gicon (self, context, gicon);
+ surface = ensure_surface_for_gicon (self, context, scale, gicon);
g_object_unref (gicon);
break;
case GTK_IMAGE_GICON:
- surface = ensure_surface_for_gicon (self, context, gtk_image_definition_get_gicon (self->priv->def));
+ surface = ensure_surface_for_gicon (self, context, scale, gtk_image_definition_get_gicon (self->priv->def));
break;
case GTK_IMAGE_ANIMATION:
gtk_icon_helper_ensure_surface (GtkIconHelper *self,
GtkStyleContext *context)
{
+ int scale;
+
if (!check_invalidate_surface (self, context))
return;
- self->priv->rendered_surface = gtk_icon_helper_load_surface (self, context);
+ scale = get_scale_factor (self, context);
+
+ self->priv->rendered_surface = gtk_icon_helper_load_surface (self, context, scale);
}
void
case GTK_IMAGE_PIXBUF:
get_pixbuf_size (self, context,
+ get_scale_factor (self, context),
gtk_image_definition_get_pixbuf (self->priv->def),
gtk_image_definition_get_scale (self->priv->def),
&width, &height, &scale);